<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <#include "include/_meta.html">
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>Insert title here</title>
</head>
<body>
<div class="container">
    <form id="AdminCarorderForm">

        <br/>
        <div class="form-group">
            <label for="realbttime">租车日期</label>
            <input type="text" class="form-control" id="realbttime" name="realbttime" placeholder="租车日期">
        </div>
        <div class="form-group">
            <label for="realettime">还车日期</label>
            <input type="text" class="form-control" id="realettime" name="realettime" placeholder="还车日期">
        </div>
        <div class="form-group">
            <button type="button" id="saveBtn" class="btn btn-success">还车</button>
            <button type="button" id="cancelBtn" class="btn btn-default">取消</button>
        </div>
    </form>
</div>

<#include "include/_footer.html">

<script>

    var updateCarorder = function () {
        if (!check().form()) {
            return;
        }
        $.ajax({
            type: "POST",
            dataType: "json",
            url: "/adminedit",
            data: {
                realbttime: $("#realbttime").val(),
                realettime: $("#realettime").val()
            },
            success: function (msg) {
                $("#cancelBtn").click();
            }
        });
    }

    $("#saveBtn").click(function () {
        updateCarorder();
    });

    $("#cancelBtn").click(function () {
        var index = parent.layer.getFrameIndex(window.name);
        parent.getOrderList();
        parent.layer.close(index);
    });


    function check() {
        return $("#AdminCarorderForm").validate({
            rules: {
                realbttime: {
                    required: true
                },
                realettime: {
                    required: true
                }
            },

            messages: {
                realbttime: {
                    required: ""
                },
                realettime: {
                    required: ""
                }
            }
        });
    }
</script>

</body>
    
    